<script type="text/javascript" src="{$TMPL}/js/jscharts_cr.js"></script>
{if $deal_list}
<div class="i_deal_list clearfix pr15 pl15">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tbody>
            <tr border="0" style="background-color:#00bef0; color:#fff; height:34px;">
                <th >借款标题</th>
                <th style="width:12%">借款目的</th>
                <th style="width:12%">金额</th>
                <th style="width:10%">年利率</th>
                <th style="width:10%">期限</th>
                <th style="width:10%">完成度</th>
                <th style="width:20%">发布日期</th>
            </tr>
            {foreach from=$deal_list item="deal" key=key name="deal"}
                <tr class="item {if $key mod 2 eq 1}item_1{/if}" {if $smarty.foreach.deal.last}style="border-bottom:0"{/if}>
                     <td>
                        <a href="{$deal.url}">{$deal.name}</a>
                    </td>
                    <td>
                        {$deal.type_match_row}
                    </td>
                    <td>
                        {$deal.borrow_amount_format}
                    </td>                    
                    <td>
                        {function name="number_format" v="$deal.rate" f="2"}%
                    </td>
                    <td>
                        {$deal.repay_time}{if $deal.repay_time_type eq 0}天{else}个月{/if}
                    </td>
                    <td>
                        <div class="graph-box">
                            <p>
                                {if  $deal.deal_status eq 5}
                                100%
                                {elseif $deal.deal_status eq 4}
                                {function name='round' v='$deal.repay_progress_point' f=0}%
                                {else}
                                {function name="round" v=$deal.progress_point f=0}%
                                {/if}
                            </p>
                            <div id="graph-{$deal.id}"></div>
                        </div>
                        <script type="text/javascript">
                            {if  $deal.deal_status eq 5}
                            <!--//已还清-->
                            var colors = ['#00bef0', '#e7e5e5'];
                            var myData = new Array(['OK', 100], ['NO', 0]);
                            {elseif $deal.deal_status eq 4}
                            <!--//还款中-->
                            var colors = ['#00bef0', '#e7e5e5'];
                            var myData = new Array([' ', {function name='round' val=$deal.repay_progress_point f=2}], [' ', <?php echo 100-round($this->_var['deal']['repay_progress_point'],2) ?>]);
                            {else}
                            <!--//筹款中-->
                            var colors = ['#00bef0', '#e7e5e5'];
                            var myData = new Array([' ', {function name='round' val=$deal.progress_point f=2}], [' ', <?php echo 100-round($this->_var['deal']['progress_point'],2) ?>]);
                            {/if}
                            var myChart = new JSChart('graph-{$deal.id}', 'pie');
                            myChart.setDataArray(myData);
                            myChart.colorizePie(colors);
                            myChart.setTitleColor('#8E8E8E');
                            myChart.setTitleFontSize(0);
                            myChart.setTextPaddingTop(280);
                            myChart.setPieValuesDecimals(1);
                            myChart.setPieUnitsFontSize(0);
                            if($.browser.msie)
                                myChart.setPieValuesFontSize(0);
                            else
                                myChart.setPieValuesFontSize(100000000);
                            myChart.setPieValuesColor('#fff');
                            myChart.setPieUnitsColor('#969696');
                            myChart.setSize(46, 46);
                            myChart.setPiePosition(0, 0);
                            myChart.setPieRadius(23);
                            myChart.setFlagColor('#1BB8E3');
                            myChart.setFlagRadius(4);
                            myChart.setTooltipOpacity(1);
                            myChart.setTooltipBackground('#ddf');
                            myChart.setTooltipPosition('ne');
                            myChart.setTooltipOffset(2);
                            myChart.draw();
                        </script>
                    </td>
                    <td>
                        <span class="f_white">
                        {if $deal.publish_wait eq 1}
                        等待审核
                        {elseif $deal.deal_status eq 0}
                        等待材料
                        {else}
							 {if $deal.deal_status eq 1}
                            进行中
							 {elseif $deal.deal_status eq 2}
                            已满标
                            {elseif $deal.deal_status eq 3}
                            流标
                            {elseif $deal.deal_status eq 4}
                            还款中
                            {elseif $deal.deal_status eq 5}
                            已还清
                            {/if}
                        </span>
                        <div class="blank"></div>
                        {function name="to_date" v="$deal.start_time" f="Y-m-d"} {function name="to_date" v="$deal.start_time" f="H:i"}
                        {/if}
                    </td>
                </tr>
            {/foreach}
        </tbody>
    </table>
	<div class="pages">{$pages}</div>
</div>
{else}
<div class="tc p15">暂无记录</div>
{/if}
<script type="text/javascript">
$(function(){
    var p_width=$(".i_deal_list p").width();
    var box_width=$(".i_deal_list .graph-box").width();
    var left_w=(box_width/2)-(p_width/2);
    $(".i_deal_list p").css("left",left_w+"px");
})  
</script>